package entities;

import entities.BasicProduct;
import dto.ResidenceDTO;

import java.io.Serializable;
import java.lang.String;
import java.util.Date;

import javax.persistence.*;

/**
 * Entity implementation class for Entity: ResidenceEntity
 *
 */
@Entity
@Table(name="RESIDENCES")
@NamedQueries({
			@NamedQuery(name=ResidenceEntity.FIND_ALL,
						query="SELECT r FROM ResidenceEntity r ORDER BY r.insertedOn ASC"),
			@NamedQuery(name=ResidenceEntity.FIND_FOR_USER,
						query="SELECT r FROM ResidenceEntity r WHERE r.available=1 AND r.disponibility > 0")
})
	
public class ResidenceEntity extends BasicProduct implements Serializable {
	private static final long serialVersionUID = 1L;
	
	public static final String FIND_ALL = "ResidenceEntity.findAll";
	public static final String FIND_FOR_USER = "ResidenceEntity.findForUser";
	
	private String residenceName;
	private String type;
	private Integer rooms;
	private Integer beds;
	private Integer stars;
	private String city;
	private String country;
	private String address;
	private String phoneNumber;
	private String site;
	@Temporal(javax.persistence.TemporalType.DATE)
	private Date fromDate;
	@Temporal(javax.persistence.TemporalType.DATE)
	private Date toDate;

	
	

	public ResidenceEntity() {
		super();
	}   
	
	
	public ResidenceEntity(ResidenceDTO residence) {
		super(residence.getId(), residence.isAvailable(), residence.getDisponibility(), residence.getPrice(), residence.getAdmin());
		this.residenceName=residence.getResidenceName();
		this.type=residence.getType();
		this.rooms=residence.getRooms();
		this.beds=residence.getBeds();
		this.city=residence.getCity();
		this.country=residence.getCountry();
		this.stars=residence.getStars();
		this.address=residence.getAddress();
		this.phoneNumber=residence.getPhoneNumber();
		this.site=residence.getSite();
		this.fromDate=residence.getFromDate();
		this.toDate=residence.getToDate();
	}  
	
	public String getResidenceName() {
		return this.residenceName;
	}

	public void setResidenceName(String residenceName) {
		this.residenceName = residenceName;
	}   
	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}   
	public Integer getRooms() {
		return this.rooms;
	}

	public void setRooms(Integer rooms) {
		this.rooms = rooms;
	}   
	public Integer getBeds() {
		return this.beds;
	}

	public void setBeds(Integer beds) {
		this.beds = beds;
	}   
	public Integer getStars() {
		return this.stars;
	}

	public void setStars(Integer stars) {
		this.stars = stars;
	}   
	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}   
	public String getPhoneNumber() {
		return this.phoneNumber;
	}

	public void setPhoneNumber(String phoneNumber) {
		this.phoneNumber = phoneNumber;
	}   
	public String getSite() {
		return this.site;
	}

	public void setSite(String site) {
		this.site = site;
	}
	
	public Date getFromDate() {
		return fromDate;
	}


	public void setFromDate(Date fromDate) {
		this.fromDate = fromDate;
	}


	public Date getToDate() {
		return toDate;
	}


	public void setToDate(Date toDate) {
		this.toDate = toDate;
	}

	
	public String getCity() {
		return city;
	}


	public void setCity(String city) {
		this.city = city;
	}


	public String getCountry() {
		return country;
	}


	public void setCountry(String country) {
		this.country = country;
	}


	@Override
	public String toString() {
		return "ResidenceEntity [residenceName=" + residenceName + ", type="
				+ type + ", rooms=" + rooms + ", beds=" + beds + ", stars="
				+ stars + ", city=" + city + ", country=" + country
				+ ", address=" + address + ", phoneNumber=" + phoneNumber
				+ ", site=" + site + ", fromDate=" + fromDate + ", toDate="
				+ toDate + "]";
	}


	
	}
	
	
   

